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

OKTA C# get token by user name and password #56

Open
rathoregee opened this issue Oct 13, 2021 · 6 comments
Open

OKTA C# get token by user name and password #56

rathoregee opened this issue Oct 13, 2021 · 6 comments

Comments

@rathoregee
Copy link

Hi Guys
I am writing a integration test for aws lamda autoriser for api gateway.

do we have any c# code example to get jwt tokens (id, access) by using (username, passord)

by making c# httpclient call to Okta?

some kind of CURL for example

curl --location --request POST ‘https://org.okta.com/oauth2/v1/token’
–header ‘Accept: application/json’
–header ‘Content-Type: application/x-www-form-urlencoded’
–header ‘Content-Type: application/x-www-form-urlencoded’
–data-urlencode ‘grant_type=password’
–data-urlencode ‘username=test.user’
–data-urlencode ‘password=p@ssw0rd’
–data-urlencode ‘scope=openid’
–data-urlencode ‘client_id={{clientId}}’

@andriizhegurov-okta
Copy link
Contributor

Hi @rathoregee, thanks for the question.
I'll inquire internally if this code sample exists and let you know here.

@andriizhegurov-okta
Copy link
Contributor

Hi @rathoregee, the flow you want to implement is not recommended. A similar flow would be the clients credentials flow, but instead of username and password you have a clientId and ClientSecret.
Here you may find all the flows listed: https://developer.okta.com/docs/guides/implement-grant-type/authcode/main/#grant-type-flow

@rathoregee
Copy link
Author

@andriizhegurov-okta i understand (implement is not recommended). I was writing a integration test, it is helpful there.

do we have any c# code sample for it.

many thanks

@andriizhegurov-okta
Copy link
Contributor

@rathoregee we don't have any code samples for not recommended flows unfortunately.

@rathoregee
Copy link
Author

ok- any code for PKCE (Proof Key for Code Exchange) in C# language

@andriizhegurov-okta
Copy link
Contributor

@rathoregee no we don't have samples of PKCE flow in C#. But there are several JS resources about Authorization Code with PKCE flow that might be helpful:

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

No branches or pull requests

2 participants