Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new provider: kakao #366

Closed
wants to merge 1 commit into from

Conversation

oiojin831
Copy link

Adding a new provider

If I go to this url
http://localhost:9999/authorize?provider=kakao

It will redirect to "agreement page?"
Screen Shot 2022-01-31 at 12 38 27

After I agree with everything.
it will redirect to

http://localhost:3000/?error=server_error&error_description=Error+getting+user+email+from+external+provider
It seems that I am not able to get my email, could anyone help me to debug this?

Since I am not familiar with golang, I couldn't find a way to log the debug message.
Could anyone help me with this.

Thanks.

@J0 J0 mentioned this pull request Jan 31, 2022
Copy link
Member

@kangmingtay kangmingtay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @oiojin831, thanks for your contributions, please add tests as well and take a look at the contributing guide for adding a new oauth provider! Thanks!

if err := makeRequest(ctx, tok, g.Config, g.APIPath+"/v2/user/me", &u); err != nil {
return nil, err
}
fmt.Printf("%+v\n", u)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove print statement

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks I will check the contributing guide again :D


func (g kakaoProvider) GetUserData(ctx context.Context, tok *oauth2.Token) (*UserProvidedData, error) {
var u kakaoUser
if err := makeRequest(ctx, tok, g.Config, g.APIPath+"/v2/user/me", &u); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the kakao api requires the developer to pass 2 additional parameters: property_keys and secure_resource, you can't use the wrapper function makeRequest, you'll need to construct the http request on your own (much like the notion implementation)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will refer the notion implementation to fix it. :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kangmingtay I am actually not familiar with golang, could you give me a help to write a debug code?
I was trying to print some log but I couldn't figure out how to do it.

Thank you

Copy link
Member

@kangmingtay kangmingtay Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can either use the fmt or log package to print the http response returned from /v2/user/me inside makeRequest

If you want to print the contents of a struct, you can try this:

var u kakaoUser
fmt.Printf("%+v", u)

It might also be worth taking a look at the tour of go to familiarise yourself with the language :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much :D

@hf
Copy link
Contributor

hf commented Aug 24, 2022

Hey this PR has been outdated for a long while now. I'll close it, but if you still wish to contribute please re-open it or submit a new one!

@hf hf closed this Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants