[web2py] Re: Web2py, react, typescript, visual studio code setup

2020-03-13 Thread Alex Beskopilny

Thanks Larry!  great example.

maybe in  *webpack.config.js*

*- app: './static/reactsrc/index.tsx'*
+ app: './static/src/index.tsx'

среда, 11 марта 2020 г., 18:59:40 UTC+3 пользователь Larry Weinberg написал:
>
> Several people have asked about how to set up web2py to work with React 
> (and Typescript) on the front end. Others have asked how to use an IDE like 
> Visual Studio Code with web2py. I have a setup that I've posted to github 
> that has the basics in place for doing this with a pre-configured Visual 
> Studio Code workspace and instructions on how to get it up and running.  
>  Web2py running inside VSCode is really easy to work with and debug!
>
> https://github.com/larrywberg/web2py-react-ts-vscode
>
> I am not an expert on Visual Studio Code, or React, or Typescript, or 
> web2py so I would be happy to get feedback to improve it.  I hope this is 
> useful for others.  It is using React with React Hooks for state 
> management.  There is a sample REST call set up.
>
> I hooked in a webpack dev server in addition to the web2py server so that 
> the react sample code can be iterated on quickly if you so choose.  You can 
> debug the python server and the Typescript client at the same time in 
> VSCode if you launch them both from the preconfigured launch tasks. You can 
> also use the Web2py admin interface to edit files in parallel with editing 
> them in VS Code when running locally.  There are other preconfigured 
> scripts set up and you can also trigger the compile of the react code from 
> a menu item in the sample code.
>
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/84d8d415-944f-46d9-aa8f-aa90d9c311ff%40googlegroups.com.


Re: [web2py] DId.app auth is good for web2py apps ?

2020-03-13 Thread Kevin Keller
You need to change your okta tenant URLs  and the client Id and Secret.

I still points to my tenant :)




On Thu, Mar 12, 2020 at 3:05 PM Kevin Keller  wrote:

> This goes into your db.py and you also need to install okta_jwt via pip.
>
> I still haven figured it out how to terminate the session in Okta and
> Web2py at the same time
>
> The redirect in the logout terminates the okta session but not the web2py
> one.
> For that you need session.forget and session.renew but this commands being
> in the model dont work, they only work in the controller.
> So need to find a way to destroy the sessions in the models through some
> sort of global variable or store the sessions in the DB retrieve them in
> the model and detroy them there.
>
>
>
> On Thu, Mar 12, 2020 at 3:02 PM Kevin Keller  wrote:
>
>> Okta_CLIENT_ID='0x'
>> Okta_CLIENT_SECRET="x"
>>
>> ## import required modules
>> try:
>> import json
>> except ImportError:
>> from gluon.contrib import simplejson as json
>> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>>
>>
>> ## extend the OAUthAccount class
>> class OktaAccount(OAuthAccount):
>> # """OAuth impl for FaceBook"""
>> AUTH_URL="https://keller.okta.com/oauth2/default/v1/authorize";
>> TOKEN_URL="https://keller.okta.com/oauth2/default/v1/token";
>>
>> def __init__(self):
>> OAuthAccount.__init__(self, None, Okta_CLIENT_ID, Okta_CLIENT_SECRET,
>> self.AUTH_URL, self.TOKEN_URL,
>> scope='openid profile email',
>> state="okta",
>> display='popup')
>>
>>
>> def get_user(self):
>> if not self.accessToken():
>> return None
>> #global token
>> token= None
>> token=self.accessToken()
>> print (token)
>> from okta_jwt.jwt import validate_token
>> issuer="https://keller.okta.com/oauth2/default";
>> audience="api://default"
>> if token != None:
>> profile=validate_token(token, issuer, audience, Okta_CLIENT_ID)
>> #print (profile)
>> if profile['sub']:
>>
>> username = profile['sub']
>>
>>
>> email = profile['sub']
>> else:
>> self.session.token = None
>>
>> if profile['sub']:
>> return dict(first_name = profile['firstname'],
>> last_name = profile['lastname'],
>> username = username,
>> email = '%s' %(email))
>>
>>
>> def logout_new(self, next="/"):
>> #self.session.token = None
>> redirect('https://keller.okta.com/oauth2/default/v1/logout?id_token_hint=
>> '+token+'&post_logout_redirect_uri='+'
>> http://130.61.243.125:8000/OktaWF/default/index')
>> session.renew(clear_session=True)
>> session.forget(response)
>> return next
>>
>>
>> auth.settings.login_form=OktaAccount()
>>
>> On Wed, Mar 11, 2020 at 4:01 PM António Ramos 
>> wrote:
>>
>>> Thank you Kevin , please share...
>>>
>>>
>>> Em qua., 11 de mar. de 2020 às 14:53, Kevin Keller 
>>> escreveu:
>>>
 Looks nice enough, though it is missing an easy way to configure scopes
 and claims.

 It dont see it anywhere in their free account actually.

 I would probably rather advice to go with Auth0 or Okta.

 I work for Okta so that is why I have integrated web2py with Okta in a
 sample app.
 I can send you the configuration and they have a free edition too for
 1000 users per month just like
 DID and you can easily configure claims and scopes.

 If you do not trust me on this go with Auth0, they can also help with
 claims and scopes and I think
 its free for 1000 users too, but Auth0 requires to do some scripting to
 configure your scopes on the Auth0 web client.

 So I think Okta is easier, but its just my 2 cents of course.




 On Wed, Mar 11, 2020 at 2:02 PM António Ramos 
 wrote:

> DID  is an Identity Provider, that authenticates
> users by verifying access to either an email address or securely stored
> private key.
>
> This gives users the ability to sign in with a single click without
> being tracked by the social login providers.
>
> It gives developers the ability to offer a modern authentication
> without having to handle validating signatures, recovering accounts from
> lost devices or verifying user email addresses.
>
>
>
> https://did.app/
>
>
> regards
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAEM0BxO8Gv%2BcJY-o_WXFEkEBMEFRA-WiPknUASOR7gXGzrKvAw%40mail.gmail.com
> 

[web2py] Re: Web2py, react, typescript, visual studio code setup

2020-03-13 Thread Larry Weinberg
Thanks for letting me know of the error.  The folder was supposed to be 
named "reactsrc" but I forgot to change it in this repo.  It's fixed now.

On Friday, March 13, 2020 at 5:40:00 AM UTC-7, Alex Beskopilny wrote:
>
>
> Thanks Larry!  great example.
>
> maybe in  *webpack.config.js*
>
> *- app: './static/reactsrc/index.tsx'*
> + app: './static/src/index.tsx'
>
> среда, 11 марта 2020 г., 18:59:40 UTC+3 пользователь Larry Weinberg 
> написал:
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8fa09068-0a3f-4812-81ea-6fdea8fa4600%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-03-13 Thread 'jim kaubisch' via web2py-users
Hi Villas,

Then I'm confused... 

I've got 15k+ lines of reasonably complex web2py based Python 3.7.6 code. 
I'm thinking ahead to when it would be wise/necessary to migrate to 3.8

Massimo said "Both web2py and py4web are currently incompatible with python 
3.8" (beginning of December) and later said "Works for me right now." 
(middle of January). 
He explained the reasons for the problems and I interpreted his second note 
as implying he fixed things.

My question is - if there were code changes to accommodate the 3.8 
incompatibilities, how does one access them given that the official version 
of web2py hasn't changed in nearly a year ?
Was also hoping that Woody would respond to say if he tried it, as he 
planned to, and what the outcome was

Am I misunderstanding something?

Thanks


On Thursday, March 12, 2020 at 11:19:57 AM UTC-7, villas wrote:
>
> web2py itself is designed to work on both versions of python.
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ac57c0a7-60e9-4e9c-bb17-77aa3b8d4ce2%40googlegroups.com.