Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@revant
Copy link
Contributor

@revant revant commented Jul 11, 2017

OAuth 2 API for apps made with Frappe Framework https://frappe.io

@revant revant closed this Jul 11, 2017
@revant revant reopened this Jul 11, 2017
@Override
public Verb getAccessTokenVerb() {
return Verb.POST;
}
Copy link
Member

Choose a reason for hiding this comment

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

no need to override this method. It's POST by default

@kullfar
Copy link
Member

kullfar commented Jul 12, 2017

The main question is "How can I test this Pull Request?". I need FrappeExample.java and app/user credentials to successfully run it.

@revant
Copy link
Contributor Author

revant commented Jul 12, 2017

Login with (Role - System Manager)
Testsite : https://scribejava.mntechnique.com
username : scribejava@example.com
password : scribejava

I'll delete above credentials after testing.

Client Details Added in Example,

Login and change client details here

https://scribejava.mntechnique.com/desk#Form/OAuth%20Client/37763ecdb0

In this case serverURL keeps changing as per the hosting domain name.

For others who wish to use their own frappe server url, I can think of extending FrappeApi to CustomFrappeApi and using it instead. I've added setter and getter for this.

Any thing better you can suggest?

e.g.

public class CustomFrappeAPI extends FrappeApi {
    protected CustomFrappeAPI(){
        setServerURL("http://custom.frappe.url.tld");
    }

    private static class InstanceHolder {
        private static final CustomFrappeAPI INSTANCE = new CustomFrappeAPI();
    }

    public static CustomFrappeAPI instance() {
        return CustomFrappeAPI.InstanceHolder.INSTANCE;
    }
}

References :

Frappe Framework is Open Source Web App Framework
Setup frappe server using frappe/bench - https://github.com/frappe/bench
Setup OAuth 2 and use REST API - http://frappe.github.io/frappe/user/en/guides/integration/
frappe framework https://github.com/frappe/frappe

@kullfar
Copy link
Member

kullfar commented Jul 13, 2017

great work, well done.
I have merged this Pull Request to the master with some additions
1.I created generic OpenId token and extractor for Google and Frappe.
2.As for custom serverUrl, it's a required param to Frappe. So, it's the required param for instance() method.
3.credentials are not needed anymore. I have tested Example, and removed credential from the sources.

@kullfar kullfar closed this Jul 13, 2017
@kullfar
Copy link
Member

kullfar commented Jul 13, 2017

I have fixed up all commits to the single one - 6dbf10e
my additions - f42812f and 48d17c2

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.