feat: generate redirect to automatically#303
Merged
neilLasrado merged 12 commits intoBloomstack:developfrom Nov 16, 2020
Merged
feat: generate redirect to automatically#303neilLasrado merged 12 commits intoBloomstack:developfrom
neilLasrado merged 12 commits intoBloomstack:developfrom
Conversation
jitendraharpalani
suggested changes
Oct 31, 2020
| @frappe.whitelist(allow_guest=True) | ||
| def get_login_url(redirect_to=None, social_login_key_name="bloomstack"): | ||
|
|
||
| if not redirect_to and frappe.get_cached_value("OAuth Client", {"app_name": "Bloomstack"}, "client_id") and frappe.get_hooks("bloomstack_redirect_uri"): |
There was a problem hiding this comment.
@hrwX App name will be Frappe for this one.
| if not redirect_to and frappe.get_cached_value("OAuth Client", {"app_name": "Bloomstack"}, "client_id") and frappe.get_hooks("bloomstack_redirect_uri"): | ||
| redirect_to = "{0}/api/method/frappe.integrations.oauth2.authorize?client_id={1}&response_type=code&scope=openid&prompt=none& \ | ||
| redirect_uri={2}".format(frappe.utils.get_url(), frappe.get_cached_value("OAuth Client", {"app_name": "Bloomstack"}, "client_id"), | ||
| frappe.get_hooks("bloomstack_redirect_uri")) |
There was a problem hiding this comment.
@hrwX sorry I just realized that OAuth Client doctype already has a Redirect URL which is something we can use.
Ref: https://demo.bloomstack.garden/desk#Form/OAuth%20Client/b0356dedd8
jitendraharpalani
suggested changes
Nov 2, 2020
| client = frappe.get_cached_doc("OAuth Client", {"app_name": "Frappe"}) | ||
| if not redirect_to and client: | ||
| redirect_to = "{0}/api/method/frappe.integrations.oauth2.authorize?client_id={1}&response_type=code&scope=openid&prompt=none& \ | ||
| redirect_uri={2}".format(frappe.utils.get_url(), client.get("client_id"), client.get("redirect_uris")) |
There was a problem hiding this comment.
better would be to use default redirect URI as the user can define multiple URLs in redirect URIs.
jitendraharpalani
approved these changes
Nov 2, 2020
neilLasrado
approved these changes
Nov 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.asana.com/0/1188976263154030/1198950940677093